import 'package:flutter/material.dart';
import 'package:get/get.dart';

class TargetPage extends StatefulWidget {
  const TargetPage({Key key}) : super(key: key);

  @override
  _TargetPageState createState() => _TargetPageState();
}

class _TargetPageState extends State<TargetPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("子页面"),
      ),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        child: Column(
          children: [
            ElevatedButton(
              child: Text("普通方式返回带参数"),
              onPressed: () {
                Navigator.of(context).pop("传过去的数据");
              },
            ),
            ElevatedButton(
              child: Text("getX方式返回带参数"),
              onPressed: () {
                Get.back(result: "getX传过去的数据");
              },
            ),
          ],
        ),
      ),
    );
  }
}
